package com.ushine.web.security.handler;

import com.ushine.web.security.response.SecurityResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author: yls
 * @Date: 2021/08/17 21:50
 * @Description: 注销成功
 * @Version 1.0
 */
@Slf4j
@Component
public class FightLogoutSuccessHandler implements LogoutSuccessHandler {

    @Resource
    SecurityResponse securityResponse;


    @Override
    public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
        securityResponse.getResponse(response, 200, "注销成功");
    }
}
